<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>提现</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../css/css.css" />
    <style>
        .aboutbody {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            flex-wrap: nowrap;
            flex-direction: column;
        }

        .aboutbody p {
            width: 92%;
            margin-top: 10px;
            text-indent: 2em;
            font-size: 14px;
            color: #666666;
        }

        html, body {
            font-size: 14px;
            height: 100%;
            background: #F5F5F5 !important;
        }

        .tixian {
            background: #fff;
            width: 90%;
            margin: auto;
            margin-top: 80px;
            padding-bottom: 1px;
        }

        .tixian p {
            color: #BBBBBB;
            padding-left: 15px;

            border-radius: 10px;
            padding-top: 10px;
            margin-bottom: 10px;
        }

        .tixian2 {
            width: 90%;
            border-bottom: 1px solid #BBBBBB;
            margin: auto;
            height: 90px;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            font-size: 30px;
            margin-bottom: 10px;
        }

        .tixian2 input {
            font-size: 20px !important;
        }

        .tixianinput {
            width: 90%;
            background: #F9A1A1;
            height: 45px;
            text-align: center;
            color: #fff;
            font-size: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: auto;
            margin-top: 20px;
            background:rgba(109,67,229,1);
            border-radius:5px;
        }

        .tixian3 {
            height: 40px;
            line-height: 40px;
            width: 90%;
            margin: auto;
        }

        .tixian3 {
            line-height: 30px;

        }
       [v-cloak] {
            display: none;
            }
    </style>
</head>

<body>
    <div v-cloak id="app">
        <div id="wrap" class="flex-wrap flex-vertical">
            <header>
                <ul>
                    <li class="active">
                        <i onclick="back()" class="icon iconfont icon-back"></i>
                        <span>余额提现</span>
                        <em @click="goCashlist">提现列表</em>
                    </li>
                </ul>
            </header>
            <div class="sharecontent fixed-header">
                <div class="tixian">
                    <p>提现金额</p>
                    <div class="tixian2">
                        <span>￥</span>
                        <input v-model="money1" type="number" placeholder="请输入提现金额">
                    </div>
                    <div class="tixian3">
                        <span>账号:</span>
                        <input v-model="account" type="text" placeholder="请输入支付宝提现账号">
                    </div>
                    <div class="tixian3">
                        <span>姓名:</span>
                        <input v-model="realname" type="text" placeholder="请输入支付宝实名">
                    </div>
                    <p>可提现余额￥{{money}}</p>
                </div>
                <div @click="getSubmit" class="tixianinput">
                    提现
                </div>
            </div>
        </div>
    </div>
    </div>
</body>

</html>
<script src="../../aui/js/aui.js"></script>
<script src="../../script/vue2.js"></script>
<script src="../../script/vue-resource.min.js"></script>
<script src="../../script/common.js"></script>
<script>
var vm = new Vue({
    el: "#app",
    data: {
        about: '',
        money: '0',
        account: '',
        realname: '',
        money1: ''
    },
    mounted: function() {
        var that = this;
        apiready = function() {
            that.getrefUserinfo()
        };
    },
    methods: {
        getrefUserinfo: function() {
            var that = this;
            showProgress();
            var token = $api.getStorage('userInfo').token
            api.ajax({
                url: ajaxRoute.center,
                method: 'post',
                data: {
                    values: {
                        token: token
                    }
                }
            }, function(res, err) {
                if (res.code == 1) {
                    api.hideProgress();
                    console.log(JSON.stringify(res))
                    that.money = res.data.money
                    that.$nextTick(function() {
                        cacheDataImg()
                    })
                } else {
                    api.hideProgress();
                    api.toast({ msg: res.msg, location: 'middle' });
                }
            });
        },
        getSubmit: function() {
            var that = this;
            showProgress();
            if (that.money1 == '') {
                api.toast({ msg: '请输入提现金额', location: 'middle' });
                return
            }
            if (that.account.length < 6) {
                api.toast({ msg: '请输入正确的支付宝账号', location: 'middle' });
                return
            }
            if (that.realname.length < 1) {
                api.toast({ msg: '请输入支付宝的实名', location: 'middle' });
                return
            }
            var token = $api.getStorage('userInfo').token
            api.ajax({
                url: ajaxRoute.withdraw,
                method: 'post',
                data: {
                    values: {
                        token: token,
                        amount: that.money1,
                        account: that.account,
                        realname: that.realname
                    }
                }
            }, function(res, err) {
                if (res.code == 1) {
                    api.hideProgress();
                    api.sendEvent({
                        name: 'charge',
                    });
                    api.toast({ msg: res.msg, location: 'middle' });
                    that.getrefUserinfo()
                } else {
                    api.hideProgress();
                    api.toast({ msg: res.msg, location: 'middle' });
                }
            });
        },
        goCashlist: function() {
            api.openWin({ //未登录打开登陆窗口
                name: 'charge',
                url: 'widget://html/Cashwithdrawal/list.html',
                delay: 0,
                slidBackType: 'edge',
                vScrollBarEnabled: false,
                slidBackEnabled: false,
            })
        },
    },
    filters: {
        getTel: function(value) {
            var phone = value
            return phone.substr(0, 3) + "****" + phone.substr(7)
        },
        getCard: function(value) {
            var phone = value
            return phone.substr(0, 5) + "********" + phone.substr(12)
        },
        getchecked: function(e) {
            var checked = ''
            if (e == 0) {
                checked = '审核中'
            } else {
                checked = '已审核'
            }
            return checked
        }
    }
})
</script>
